;; import printing/pretty-print.scm

(pretty-print '(f g h (x y z)))
(newline)
(pretty-print '(f (g h i) (x y z) ayy ay y ayyy ay))
(newline)
(pretty-print '(o (b (a (b o) a) b)
		  (b (a (b o) a) b)))
(newline)

(pretty-print
 '(define (spaces display n)
    (if (= 0 n)
	#t
	(begin (display space) (spaces display (- n 1))))))
(newline)

(pretty-print
 '(define (make-printer)
  (let ((position 0))
    (list (lambda ()
	    position)
	  (lambda ()
	    (newline)
	    (set! position 0))
	  (lambda (x)
	    (let ((x (if (symbol? x) (symbol->string x)
			 (if (number? x) (number->string x)
			     (if (boolean? x)
				 (if x #t #f)
				 x)))))
	      (display x)
	      (set! position (+ position (string-length x)))))))))
(newline)

(pretty-print
 '(list (begin 1 2)
	(begin 3 4)
	(list a b c d)
	(begin 5 6)))
(newline)


(pretty-print
 '(list a b (begin c d) e))
(newline)
